package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface UserMapper {
    /**
     * 根据openid查询用户是否已存在
     * @param openid 1
     * @return 1
     */
    // 根据openid查询用户
    @Select("select * from user where id=#{openid}")
    User getByOpenid(String openid);

    /**
     * 插入user
     * @param user 1
     */
    // 插入用户
    void insert(User user);

    /**
     * 根据id查询用户
     * @param Id 1
     * @return 1
     */
    @Select("select * from user where id = #{id}")
    User getById(Long Id);

    /**
     * 根据动态条件统计用户数量
     * @param map 1
     * @return 1
     */
    Integer countUserByMap(Map map);

}
